﻿using System;
using System.Collections.Generic;
using System.Data;
using Complaint.Models.Dtos.Validators;

namespace Complaint.Models.Dtos
{
    /// <summary>
    /// A custom wrapper exception class to expose the list of ruleviolations
    /// </summary>
    public class ComplaintDataException : DataException
    {
        private readonly IEnumerable<RuleViolation> _errors;

        public ComplaintDataException(string exceptionMessage, IEnumerable<RuleViolation> errors)
            : base(exceptionMessage)
        {
            _errors = errors;
        }

        public ComplaintDataException(
            string exceptionMessage, 
            Exception innerException, 
            IEnumerable<RuleViolation> errors)
            : base(exceptionMessage, innerException)
        {
            _errors = errors;
        }

        public IEnumerable<RuleViolation> DataValidationErrors
        {
            get { return _errors; }
        }
    }
}
